using System.IO;
using System.Reflection;
using GrapeCity.Documents.Excel;

namespace GrapeCity.Documents.Excel.Examples.Templates.GlobalOptions.EmbedFontForFormFields
{
    class Program
    {
        static void Main(string[] args)
        {
			//create a new workbook
			var workbook = new GrapeCity.Documents.Excel.Workbook();
			
			//Load template file from resource
			var templateFile = GetResourceStream("xlsx\\Template_EmbedFontForFormFields.xlsx");
			workbook.Open(templateFile);
			
			//Init template global settings
			workbook.Names.Add("TemplateOptions.EmbedFontForFormFields", "false");
			
			//Invoke to process the template
			workbook.ProcessTemplate();
			        
			// Save to a pdf file
			workbook.Save("EmbedFontForFormFields.pdf");

        }

		static Stream GetResourceStream(string resourcePath)
        {
            string resource = "EmbedFontForFormFields.Resource." + resourcePath.Replace("\\", ".");
            var assembly = typeof(Program).GetTypeInfo().Assembly;
            return assembly.GetManifestResourceStream(resource);
        }

    }
}